package com.example.tys.daggermvp.network.retrofit2;

import retrofit2.CallAdapter;
import retrofit2.Retrofit;

/**
 * 使用BaseRetrofit默认创建方式，未做任何修改。单例模型，全局共用BaseRetrofit。
 *
 * @author tys
 * @date 2018/4/22
 */

public class RetrofitDefault extends BaseRetrofit {
    private static RetrofitDefault instance;

    private static RetrofitDefault getInstance() {
        if (instance == null) {
            synchronized (RetrofitDefault.class) {
                if (instance == null) {
                    instance = new RetrofitDefault();
                }
            }
        }
        return instance;
    }

    public static Retrofit getRetrofit() {
        return getInstance().get();
    }

    @Override
    protected CallAdapter.Factory getCallAdapterFactory() {
        return super.getCallAdapterFactory();
    }

    @Override
    public ApiEndpoint getApiEndpoint() {
        return new ApiEndpoint() {
            @Override
            public String getEndpoint() {
//               return "http://192.168.3.4:8080/";
//                return "http://www.12306.cn/";
                   return "https://www.sojson.com/";  //https://www.sojson.com/api/qqmusic/8446666
//               return "https://pan.baidu.com/";
//                return "https://www.sojson.com/open/api/weather/json.shtml/";
            }
        };
    }


}
